struct tpm_chip;
struct tpm_private;
-struct tpm_virtual_device {
- /*
- * This field indicates the maximum size the driver can
- * transfer in one chunk. It is filled in by the front-end
- * driver and should be propagated to the generic tpm driver
- * for allocation of buffers.
- */
- unsigned int max_tx_size;
-};
-
struct vtpm_state {
struct transmission *current_request;
spinlock_t req_list_lock;
unsigned long disconnect_time;
- struct tpm_virtual_device *tpmvd;
-
/*
* The following is a private structure of the underlying
* driver. It is passed as parameter in the send function.
/* these functions are offered by tpm_vtpm.c */
struct tpm_chip *init_vtpm(struct device *,
- struct tpm_virtual_device *,
struct tpm_private *);
void cleanup_vtpm(struct device *);
int vtpm_vd_recv(const struct tpm_chip* chip,
}
}
-struct tpm_virtual_device tvd = {
- .max_tx_size = PAGE_SIZE * TPMIF_TX_RING_SIZE,
-};
-
static int tpmfront_probe(struct xenbus_device *dev,
const struct xenbus_device_id *id)
{
if (!tp)
return -ENOMEM;
- tp->chip = init_vtpm(&dev->dev, &tvd, tp);
+ tp->chip = init_vtpm(&dev->dev, tp);
if (IS_ERR(tp->chip))
return PTR_ERR(tp->chip);
xenbus_register_frontend(&tpmfront);
}
-static void __exit exit_tpm_xenbus(void)
-{
- xenbus_unregister_driver(&tpmfront);
-}
-
static int tpmif_allocate_tx_buffers(struct tpm_private *tp)
{
unsigned int i;
static void tpmif_rx_action(unsigned long priv)
{
struct tpm_private *tp = (struct tpm_private *)priv;
-
int i = 0;
unsigned int received;
unsigned int offset = 0;
u8 *buffer;
- tpmif_tx_request_t *tx;
- tx = &tp->tx->ring[i].req;
+ tpmif_tx_request_t *tx = &tp->tx->ring[i].req;
atomic_set(&tp->tx_busy, 0);
wake_up_interruptible(&tp->wait_q);
buffer = kmalloc(received, GFP_ATOMIC);
if (!buffer)
- goto exit;
+ return;
for (i = 0; i < TPMIF_TX_RING_SIZE && offset < received; i++) {
struct tx_buffer *txb = tp->tx_buffers[i];
vtpm_vd_recv(tp->chip, buffer, received, tp->tx_remember);
kfree(buffer);
-
-exit:
-
- return;
}
}
-void __exit tpmif_exit(void)
-{
- exit_tpm_xenbus();
- tpm_private_put();
- gnttab_free_grant_references(gref_head);
-}
-
module_init(tpmif_init);
MODULE_LICENSE("Dual BSD/GPL");